package thread;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 25397
 * Date: 2022-04-02
 * Time: 16:05
 */
public class Demo23 {
    public static void main(String[] args) {
        Timer timer=new Timer();
        timer.schedule(new TimerTask() {//TimerTask实现了Runnable接口
            @Override
            public void run() {
                System.out.println("我是 timer");
            }
        },3000);//第一个参数任务：说白了就是一段代码
        System.out.println("我是main");
    }
}
